package com.googlecode.restitory.gae;

import java.util.Arrays;

public class TextContent extends Content {

	private char[] value;

	public TextContent() {
		value = new char[0];
	}

	public TextContent(String str) {
		this(str.toCharArray());
	}

	public TextContent(char[] charArray) {
		this.value = charArray;
	}

	public char[] getValue() {
		return value;
	}

	public void setValue(char[] value) {
		this.value = value;
	}

	@Override
	public String toString() {
		if (value == null) {
			return "null";
		}
		return String.valueOf(value);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Arrays.hashCode(value);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TextContent other = (TextContent) obj;
		if (!Arrays.equals(value, other.value))
			return false;
		return true;
	}

}
